


#ifndef PF_FONTLIST_H
#define PF_FONTLIST_H


#include <QList>
#include "lx_Export.h"
class PF_Font;

#define PF_FONTLIST PF_FontList::instance()

/**
 * The global list of fonts. This is implemented as a singleton.
 * Use PF_FontList::instance() to get a pointer to the object.
 *

 */
class LX_EXPORT PF_FontList {
protected:
    PF_FontList();

public:
    /**
     * @return Instance to the unique font list.
     */
    static PF_FontList* instance() {
        if (uniqueInstance==NULL) {
            uniqueInstance = new PF_FontList();
        }
        return uniqueInstance;
    }

    virtual ~PF_FontList() {}

    void init();

    void clearFonts();
    int countFonts() {
        return fonts.count();
    }
    virtual void removeFont(PF_Font* font);
    PF_Font* requestFont(const QString& name);

    //! @return a const iterator for the font list.
    QListIterator<PF_Font *> getIteretor(){
        return QListIterator<PF_Font *>(fonts);
    }

    friend std::ostream& operator << (std::ostream& os, PF_FontList& l);

protected:
    static PF_FontList* uniqueInstance;

private:
    //! fonts in the graphic
    QList<PF_Font *> fonts;
};

#endif
